package com.fs.controller;

import com.fs.service.DbInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

/**
 * Created by fengshuai on 17/5/19.
 */
@Controller
@RequestMapping("/db")
public class DbInfoController {

    @Autowired
    private DbInfoService dbInfoService;

    @RequestMapping("/info")
    @ResponseBody
    public ModelMap info(HttpServletResponse response) {
        response.addHeader("Access-Control-Allow-Origin", "*");
        ModelMap map = new ModelMap();
        map.addAttribute("success", true);
        map.addAttribute("data", this.dbInfoService.getAllList());
        return map;
    }
}
